function xmlHttpPost(strURL, reqtype, data) {
   try{
   	var objFrm = document.getElementById("objFrm");
   	var objMessArea = document.getElementById("messArea");
	
	    //objMessArea.innerHTML = strURL
	    var xmlHttpReq = false;
	    var self = this;
	    // Mozilla/Safari
	    if (window.XMLHttpRequest) {
	        self.xmlHttpReq = new XMLHttpRequest();
	    }
	    // IE
	    else if (window.ActiveXObject) {
	        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	    }else{
	    	objMessArea.innerHTML = "unsupported feature";
	    	return 0;
	    }
	    self.xmlHttpReq.open('POST', strURL, true);
	    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	    self.xmlHttpReq.onreadystatechange = function(){
	    		if (self.xmlHttpReq.readyState == 4) {
	    			eval(reqtype);	
	    		}
	    };
	    self.xmlHttpReq.send(data);
    }catch(e){
    	 objMessArea.innerHTML = "ERRORE\n" + e.description;
    }
}

function loadChildAttribute(selCTRL){
	var objMessArea = document.getElementById("messArea");
	var objChildAttr = document.getElementById(selCTRL);	
	var resp = self.xmlHttpReq.responseText;	
	if(resp.indexOf("Error") >= 0){
		objMessArea.innerHTML = resp;
	}else{
		//elimino le option presenti
		objChildAttr.innerHTML = "";
		//inserisco le nuove option
		var newOption = document.createElement("option");
  		newOption.value = "";
  		newOption.innerHTML = "----";
  		objChildAttr.appendChild(newOption);
		aTmp = resp.split("\n");
		for(j=0;j<aTmp.length;j++){
			if(aTmp[j] != ""){
				aTmpElem = aTmp[j].split("|");
				var newOption = document.createElement("option");
				newOption.value = aTmpElem[0];
				newOption.innerHTML = aTmpElem[1];
				objChildAttr.appendChild(newOption);		
	  		}
  		}
	}
}
	
function getChildAttribute(selCTRLTarget, selCTRLSource){
	var objEnt = document.getElementById(selCTRLSource);
	var objXSN = document.getElementById("xsn");
	var data = "entity=" + objEnt.value + "&xsn=" + objXSN.value;
	xmlHttpPost("../_inc/_getChildAttribute.php", "loadChildAttribute('" + selCTRLTarget + "')", data);
}